fn if_sentence() {
    let condition = true;
    let number = if(condition) {5} else {6};

    println!("number value {}",number);

}

//嵌套循环的标签使用
pub fn loop_label() {
    let mut count = 0;
    'counting_up: loop {
        println!("count = {}",count);
        let mut remaining = 10;

        loop{
            println!("remaining = {}",remaining);
            if remaining == 9 {
                break;
            }
            if count == 2 {
                break 'counting_up;
            }

            remaining -= 1;
        }

        count += 1;
    }

    // get loop-ret value
    let loop_ret = loop {
        break 3*5;
    };

    println!("End count = {}\n,loop_ret{loop_ret}",count);

    //while
    let mut index = 0;
    let a = [10,20,30,40,50];

    // while index < 5 {
    //     println!("the value is {}",a[index]);
    //     index += 1;
    // }

    //simply expression
    for element in a {
        println!("the value is {element}");
    }

    for number in(1..4).rev() {
        println!("{}!",number);//3 2 1
    }

    println!("LISTOFF!!");
}

